/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-05-26
*/
package com.rzico.basics.service;

import com.rzico.base.BaseMapper;
import com.rzico.base.impl.BaseServiceImpl;
import com.rzico.basics.entity.MemberFavorites;
import com.rzico.basics.entity.MemberTrace;
import com.rzico.basics.entity.Product;
import com.rzico.basics.model.ProductVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rzico.basics.mapper.MemberTraceMapper;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * <pre>
 * 足迹业务类
 * </pre>
 *
 * @author Rzico Boot
 * @version 1.0
 */
@Service
public class MemberTraceService extends BaseServiceImpl<MemberTrace, String> {

    @Autowired
    private MemberTraceMapper memberTraceMapper;

    @Override
    public BaseMapper<MemberTrace, String> getMapper() {
        return memberTraceMapper;
    }



    public List<ProductVo> selectProductVoList(Map<String, Object> params) {
        return memberTraceMapper.selectProductVoList(params);
    }


    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteByIds(Object[] ids) {
        int rw = 0;
        for (Object id:ids) {

            MemberTrace memberTrace = new MemberTrace();
            memberTrace.setProductId(Long.valueOf(String.valueOf(id)));
            memberTrace.setProductType(0);
            rw = rw + super.delete(memberTrace);
        }
        return rw;
    }

}
